import req from '@/utils/wxApi/request';
import baseURL from './index'


/**
 * 微信用户登入
 * @param  {string}  code [wx.login中返回的code]
 */
const login = (data, load) => req(data, 'POST', '/data-collector/wxUserLogin', load);


/**
 * 获取Disbility Tag List（更新个人信息需要）
 * @param  {string}  wxOpenId [openid]
 */
const getTagList = (data, load) => req(data, 'POST', '/data-collector/wxUserGetDisbilityTags', load);


/**
 * 更新微信用户个人信息
 * @param  {string}  wxOpenId [openid]
 */
// const updateUserInfoAction = 'wxUserGetAccessibilityFacilityCategoryList'
const updateUserInfo = (data, load) => req(data, 'POST', '/data-collector/wxUserUpdateUserInfo', load);


/**
 * 获取Accessibility Facility Category List（无障碍设施分类列表，更新无障碍信息需要用到）
 * @param  {string}  action       [wxUserGetAccessibilityFacilityCategoryList]
 * @param  {string}  wxOpenId     [openid]
 */
const getCategoryList = (data, load) => req(data, 'POST', '/data-collector/wxUserGetAccessibilityFacilityCategoryList', load);


/**
 * 上传无障碍信息（very important）
 * @param  {[type]}  item [description]
 */
const uploadFacilityInfo = (data, load) => req(data, 'POST', '/data-collector/wxUserUploadAccessibilityFacilityInfo', load);


/**
 * 上传无障碍信息中的图片
 */
const upLoadImg = baseURL + '/data-collector/wxUserUploadAccessibilityFacilityPhoto'

export default {
    login,
    getTagList,
    updateUserInfo,
    getCategoryList,
    uploadFacilityInfo,
    upLoadImg
}